package com.youbug.custservice.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.youbug.common.vo.QueryVo;
import com.youbug.custservice.entity.Message;
import com.youbug.custservice.service.IMessageService;
import com.youbug.common.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 消息表 前端控制器
 * </p>
 *
 * @author youbug
 * @since 2023-01-07
 */
@RestController
@RequestMapping("/message")
public class MessageController {

    @Autowired
    private IMessageService messageService;

    @PostMapping("/getMessagesByKeyword")
    public R<IPage<Message>> getChats(@RequestBody QueryVo<Message> queryVo){

        IPage<Message> messages = messageService.getMessagesByKeyword(queryVo);

        return R.ok(messages);
    }

}

